<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css"
	href="../EXT4/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css"
	href="../css/style.css" />
<script type="text/javascript" src="../EXT4/ext-all.js"></script>
<script type="text/javascript" src="../script/ext-lang-zh_CN.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
	Ext.QuickTips.init();
	
	Ext.apply(Ext.form.VTypes,{
		password:function(val,field){
			if(field.confirmTo){
				var pwd=Ext.getCmp(field.confirmTo);
				return (val==pwd.getValue());
			}
			return true; 
		}
	}); 
	
	var form=Ext.widget({
		xtype: 'form',
		layout: 'form',
        frame: true,
        renderTo:'changepassword',
        title:'修改密码',
        width:350,
		items :[{
			xtype: 'textfield',
			name:'user.password',
			inputType:'password',
            fieldLabel: '旧密码:',
            labelWidth:80,
            margin:5
        },{
        	xtype: 'textfield',
        	id:'newPassword',
        	name:'newPassword',
        	inputType:'password',
            fieldLabel: '新密码:',
            allowBlank:false,
            minLength:3,
            labelWidth:80,
            margin:5
        },{
        	xtype: 'textfield',
        	inputType:'password',
            fieldLabel: '确认新密码:',
            vtype:'password',
            confirmTo:'newPassword',
            vtypeText:'密码不一致',
            labelWidth:80,
            margin:5
        }],
        buttons:[{
        	text:'确定',
        	handler:function() {
        		this.up('form').getForm().submit({
        			url:'../service/user_changepassword',
        			success:function(form, action) {
        				Ext.Msg.alert('提示',action.result.msg);
        			},failure:function(form, action) {
        				Ext.Msg.alert('提示',action.result.msg);
        			}
        		});
        	}},{
        		text:'重置',
        		handler:function() {
        			this.up('form').getForm().reset();
        		}
        	}]
	});
	
});
</script>
</head>
<body>
	<div id="changepassword"></div>
</body>
</html>